<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCouponRulesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('coupon_rule', function (Blueprint $table) {
            $table->increments('rule_id')->comment('主键自增无意义');
            $table->string('title',255)->comment('规则名称');
            $table->string('brief',255)->comment('规则描述');
            $table->enum('reduce_type',['freeship','subtract','discount'])->default('subtract')->comment('优惠类型 subtarct：满减  subtract：免邮  discount:折扣');
            $table->text('conditions')->nullable()->comment('商品、品牌、分类 满多少等条件序列化');
            $table->text('actions')->nullable()->comment('优惠方案序列化');
            $table->integer('p_order')->default(0)->comment('排序');
            $table->tinyInteger('disabled')->default(0)->comment('是否删除 0-否 1-是');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('coupon_rule');
    }
}
